/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package algorithms;

import genotypes.Angles;
import genotypes.AnglesPopulation;
import objectives.ObjectiveFunction;
import operators.CrossoverOperator;
import operators.MutationOperator;
import operators.SplitOperator;

/**
 *
 * @author rusak
 */
public class IDEA {

    private CrossoverOperator cOp;
    private MutationOperator mOp;
    private SplitOperator sOp;
    private ObjectiveFunction f;
    private int popSize;
    private int anglesLength;
    private int iterations;
    private double[][] limitations;

    public IDEA(CrossoverOperator cOp, MutationOperator mOp, SplitOperator sOp,
            ObjectiveFunction f, int popSize, int anglesLength, int iterations,
             double[][] limitations) {
        this.cOp = cOp;
        this.mOp = mOp;
        this.sOp = sOp;
        this.f = f;
        this.popSize = popSize;
        this.anglesLength = anglesLength;
        this.iterations = iterations;
        this.limitations = limitations;
    }

    public Angles run() {

    /*    AnglesPopulation population = AnglesPopulation.randomPopulation(anglesLength, popSize, limitations);
        AnglesPopulation descendants;
        Angles pretendant;
        Angles best = Angles.randomAngles(anglesLength, limitations);
        best.setEvaluation(f.evaluate(best));
        population.evaluate(f);
        for (int i = 0; i < iterations; i++) {
            if (best.getDistanceToDest()
                    > (pretendant = population.bestIndividual()).getDistanceToDest()) {
                best = pretendant;

            }
            descendants = cOp.crossover(population, limitations);
            descendants = mOp.mutate(descendants, limitations);
            descendants.evaluate(f);
            if (best.getDistanceToDest()
                    > (pretendant = descendants.bestIndividual()).getDistanceToDest()) {
                best = pretendant;

            }
            population = sOp.split(population, descendants);

        }
        return best;*/
        return null;
    }
}
